package com.softhis.rekrutacja.shared.dto;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;

import com.extjs.gxt.ui.client.data.BeanModelTag;

/**
 * @author Tomek
 *
 */
@Entity
@Table(name = "user")
public class UserDTO implements  BeanModelTag, Serializable {

	/**
	 * default serial version id
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue
	@Column(name = "id")
	private int userId;
	
	@Column(name="login", nullable = false, length=30)
	private String login;
	
	@Column(name="password", nullable = false, length=30)
	private String password;
	
	@Column(name="lastname", nullable = false, length=30)
	private String name;
	
	@Column(name="name", nullable = false, length=30)
    private String lastName;
	
	@Column(name="birthdate", nullable = false)
	@DateTimeFormat(iso = ISO.DATE)
	private Date birthDate = new Date();
	
	public UserDTO(){
	}
		
	public UserDTO(int userid){
		this.userId = userid;
	}
	

	public UserDTO(int userId, String login, String password, String name,
			String lastName, Date birthDate) {
		this.userId = userId;
		this.login = login;
		this.password = password;
		this.name = name;
		this.lastName = lastName;
		this.birthDate = birthDate;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public Date getBirthDate() {
		return birthDate;
	}

	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}

	public void copy( UserDTO user ) {
		this.userId = user.userId;
		this.login = user.login;
		this.password = user.password;
		this.name = user.name;
		this.lastName = user.lastName;
		this.birthDate = user.birthDate;
	}
}

